<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>Phonon.VideoWidget Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">Phonon.VideoWidget Class Reference<br /><sup><sup>[<a href="phonon.html">phonon</a> module]</sup></sup></h1><p>The VideoWidget class provides a widget that is used to display
video. <a href="#details">More...</a></p>

<p>Inherits <a href="qwidget.html">QWidget</a> and <a href="phonon-abstractvideooutput.html">AbstractVideoOutput</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="phonon-videowidget.html#AspectRatio-enum">AspectRatio</a></b> { AspectRatioAuto, AspectRatioWidget, AspectRatio4_3, AspectRatio16_9 }</li><li><div class="fn" />enum <b><a href="phonon-videowidget.html#ScaleMode-enum">ScaleMode</a></b> { FitInView, ScaleAndCrop }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="phonon-videowidget.html#VideoWidget">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />AspectRatio <b><a href="phonon-videowidget.html#aspectRatio">aspectRatio</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="phonon-videowidget.html#brightness">brightness</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="phonon-videowidget.html#contrast">contrast</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#enterFullScreen">enterFullScreen</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="phonon-videowidget.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#exitFullScreen">exitFullScreen</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="phonon-videowidget.html#hue">hue</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent)</li><li><div class="fn" />float <b><a href="phonon-videowidget.html#saturation">saturation</a></b> (<i>self</i>)</li><li><div class="fn" />ScaleMode <b><a href="phonon-videowidget.html#scaleMode">scaleMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#setAspectRatio">setAspectRatio</a></b> (<i>self</i>, AspectRatio)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#setBrightness">setBrightness</a></b> (<i>self</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#setContrast">setContrast</a></b> (<i>self</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#setFullScreen">setFullScreen</a></b> (<i>self</i>, bool&#160;<i>fullscreen</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#setHue">setHue</a></b> (<i>self</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#setSaturation">setSaturation</a></b> (<i>self</i>, float&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="phonon-videowidget.html#setScaleMode">setScaleMode</a></b> (<i>self</i>, ScaleMode)</li><li><div class="fn" />QImage <b><a href="phonon-videowidget.html#snapshot">snapshot</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The VideoWidget class provides a widget that is used to display
video.</p>
<p>The VideoWidget class renders the video of a media stream on a
<a href="qwidget.html">QWidget</a>. It is connected to the <a href="phonon-mediaobject.html">MediaObject</a>, of which video stream it
should render. You connect the two objects using the <a href="phonon-path.html#createPath">Phonon.createPath</a>()
function.</p>
<p>The widget has some possibilities to manipulate the video
stream. You can change the <a href="phonon-videowidget.html#brightness-prop">brightness</a>(),
<a href="phonon-videowidget.html#hue-prop">hue</a>(), <a href="phonon-videowidget.html#saturation-prop">saturation</a>(), and
<a href="phonon-videowidget.html#contrast-prop">contrast</a>().</p>
<p>Resizing of the video is handled automatically, but you can
affect the way the video is resized with the <a href="phonon-videowidget.html#aspectRatio-prop">aspectRatio</a> and
<a href="phonon-videowidget.html#scaleMode-prop">scaleMode</a>
properties. By default, the widget will use the aspect ratio of the
video stream itself.</p>
<p>The video widget takes the size of the video when it receives a
new video stream (i.e., when a new <a href="phonon-mediasource.html">MediaSource</a> is set on the <a href="phonon-mediaobject.html">MediaObject</a> to which it is
connected). If you need to know the size of the video, you can call
<a href="qwidget.html#sizeHint-prop">sizeHint()</a> after the video
has been loaded (i.e., after the <a href="phonon-mediaobject.html">MediaObject</a> leaves the <a href="phonon.html#State-enum">LoadingState</a>).</p>
<p>It is also possible to go to <a href="phonon-videowidget.html#fullScreen-prop">full screen</a> mode.</p>
<p>A typical example of usage follows below:</p>
<pre class="cpp">
 MediaObject <span class="operator">*</span>media <span class="operator">=</span> <span class="keyword">new</span> MediaObject(parent);
 VideoWidget <span class="operator">*</span>vwidget <span class="operator">=</span> <span class="keyword">new</span> VideoWidget(parent);
 Phonon<span class="operator">.</span>createPath(media<span class="operator">,</span> vwidget);
</pre><hr /><h2>Type Documentation</h2><h3 class="fn"><a name="AspectRatio-enum" />VideoWidget.AspectRatio</h3><p>Defines the width:height to be used for the video.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>Phonon.VideoWidget.AspectRatioAuto</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Let the decoder find the aspect ratio
automatically from the media file (this is the default).</td>
</tr>
<tr>
<td class="topAlign">
<tt>Phonon.VideoWidget.AspectRatioWidget</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Fits the video into the widget making the
aspect ratio depend solely on the size of the widget. This way the
aspect ratio is freely resizeable by the user.</td>
</tr>
<tr>
<td class="topAlign">
<tt>Phonon.VideoWidget.AspectRatio4_3</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Make width/height == 4/3, which is the old TV
size and monitor size (1024/768 == 4/3). (4:3)</td>
</tr>
<tr>
<td class="topAlign">
<tt>Phonon.VideoWidget.AspectRatio16_9</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">Make width/height == 16/9, which is the size
of most current media. (16:9)</td>
</tr>
</table>


<h3 class="fn"><a name="ScaleMode-enum" />VideoWidget.ScaleMode</h3><p>The ScaleMode enum describes how to treat aspect ratio during
resizing of video.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>Phonon.VideoWidget.FitInView</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The video will be fitted to fill the view
keeping aspect ratio.</td>
</tr>
<tr>
<td class="topAlign">
<tt>Phonon.VideoWidget.ScaleAndCrop</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The video is scaled</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="VideoWidget" />VideoWidget.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new video widget with the specified
<i>parent</i>.</p>


<h3 class="fn"><a name="aspectRatio" /><a href="phonon-videowidget.html#AspectRatio-enum">AspectRatio</a> VideoWidget.aspectRatio (<i>self</i>)</h3><h3 class="fn"><a name="brightness" />float VideoWidget.brightness (<i>self</i>)</h3><h3 class="fn"><a name="contrast" />float VideoWidget.contrast (<i>self</i>)</h3><h3 class="fn"><a name="enterFullScreen" />VideoWidget.enterFullScreen (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void enterFullScreen()</tt>.</p><p>Convenience slot, calling setFullScreen(true)</p>


<h3 class="fn"><a name="event" />bool VideoWidget.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="exitFullScreen" />VideoWidget.exitFullScreen (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void exitFullScreen()</tt>.</p><p>Convenience slot, calling setFullScreen(false)</p>


<h3 class="fn"><a name="hue" />float VideoWidget.hue (<i>self</i>)</h3><h3 class="fn"><a name="mouseMoveEvent" />VideoWidget.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>


<h3 class="fn"><a name="saturation" />float VideoWidget.saturation (<i>self</i>)</h3><h3 class="fn"><a name="scaleMode" /><a href="phonon-videowidget.html#ScaleMode-enum">ScaleMode</a> VideoWidget.scaleMode (<i>self</i>)</h3><h3 class="fn"><a name="setAspectRatio" />VideoWidget.setAspectRatio (<i>self</i>, <a href="phonon-videowidget.html#AspectRatio-enum">AspectRatio</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setAspectRatio(Phonon::VideoWidget::AspectRatio)</tt>.</p><h3 class="fn"><a name="setBrightness" />VideoWidget.setBrightness (<i>self</i>, float&#160;<i>value</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setBrightness(qreal)</tt>.</p><h3 class="fn"><a name="setContrast" />VideoWidget.setContrast (<i>self</i>, float&#160;<i>value</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setContrast(qreal)</tt>.</p><h3 class="fn"><a name="setFullScreen" />VideoWidget.setFullScreen (<i>self</i>, bool&#160;<i>fullscreen</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setFullScreen(bool)</tt>.</p><h3 class="fn"><a name="setHue" />VideoWidget.setHue (<i>self</i>, float&#160;<i>value</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setHue(qreal)</tt>.</p><h3 class="fn"><a name="setSaturation" />VideoWidget.setSaturation (<i>self</i>, float&#160;<i>value</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setSaturation(qreal)</tt>.</p><h3 class="fn"><a name="setScaleMode" />VideoWidget.setScaleMode (<i>self</i>, <a href="phonon-videowidget.html#ScaleMode-enum">ScaleMode</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setScaleMode(Phonon::VideoWidget::ScaleMode)</tt>.</p><h3 class="fn"><a name="snapshot" /><a href="qimage.html">QImage</a> VideoWidget.snapshot (<i>self</i>)</h3><p>Returns a snapshot of the current frame shown in the widget.</p>
<p>This function was introduced in Qt 4.7.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>